import { defineStore } from 'pinia'
import { DialogType, DialogOptions } from '@/types'

export const useDialogStore = defineStore('dialog', {
	state: () => ({
		visible: false,
		type: '' as DialogType,
		options: {} as DialogOptions
	}),
	actions: {
		show(type: DialogType, options: DialogOptions) {
			this.visible = true
			this.type = type
			this.options = {
				contentIndent: true,
				confirmShow: true,
				cancelShow: true,
				...options
			}
		},
		hide() {
			this.visible = false
		}
	},
	getters: {},
	persist: false
})
